/**
 * @author Tobias Boehm
 *
 * 16.05.2011
 */
package org.anddev.andengine.extension.tbsengine.match.playerslot;

import org.anddev.andengine.extension.tbsengine.faction.AbsBaseFaction;
import org.anddev.andengine.extension.tbsengine.match.playerslot.AbsPlayerSlot.SlotState;
import org.anddev.andengine.extension.tbsengine.player.BasePlayer;
import org.anddev.andengine.extension.tbsengine.team.Team;

/**
 * This is the interface for a listener which is notified if something changed 
 * in the corresponding {@link AbsPlayerSlot}.
 * You may implement this interface in a view which represents an {@link AbsPlayerSlot}.
 * <p>
 * Notice:<br>
 * If you extend {@link AbsPlayerSlot} with additional components (like a 
 * faction color) you may want to extend this interface as well. 
 * 
 * 
 * @author Tobias Boehm
 *
 * @param <FactionBaseClass> Your implementation of {@link AbsBaseFaction}
 */
public interface IAbsPlayerSlotChangedListener<FactionBaseClass extends AbsBaseFaction>{
	
	/**
	 * This method is called when the team status of a corresponding 
	 * {@link AbsPlayerSlot} changed.
	 * 
	 * @param pNewTeam - The new team.
	 */
	public void onTeamChangedListener(final Team pNewTeam);
	
	/**
	 * This method is called when the corresponding {@link AbsPlayerSlot}
	 * changed its state to {@link SlotState#OPEN} or {@link SlotState#CLOSED}.
	 * <p>
	 * Notice:<br>
	 * This method won't be called if the slot state changed to {@link SlotState#OCCUPIED}.
	 * In this case a player change happened and {@link #onPlayerChanged(BasePlayer)} will 
	 * be called instead.
	 * 
	 * @param pNewSlotState will be {@link SlotState#OPEN} or {@link SlotState#CLOSED}
	 */
	public void onSlotOpenedOrClosed(final SlotState pNewSlotState);
	
	
	/**
	 * This method is called when a player change happened. If the slot
	 * state changed to {@link SlotState#OPEN} or {@link SlotState#CLOSED}
	 * (which means their is no player in this slot anymore) {@link #onSlotOpenedOrClosed(SlotState)}
	 * is called instead.
	 * 
	 * @param pNewPlayer - The new player occupying the corresponding {@link AbsPlayerSlot} 
	 */
	public void onPlayerChanged(final BasePlayer pNewPlayer);
	
	/**
	 * This method is called when a faction change happened.
	 * 
	 * @param pNewFaction - The new faction of the corresponding {@link AbsPlayerSlot}
	 */
	public void onFactionChanged(final FactionBaseClass pNewFaction);
}